package cy1;
public class Solution {
    public boolean isNumber(String s) {
        if (s == null || s.length() == 0) {
            return false;
        }
        char[] arr = s.trim().toCharArray();
        boolean numFlag = false;
        boolean dotFlag = false;
        boolean eFlag = false;
        for (int i = 0; i < arr.length; i++) {
            if ((arr[i] >='0' && arr[i] <='9') ) {
                numFlag = true;
            } else if (arr[i] == '.' && !dotFlag && !eFlag) {
                dotFlag = true;
            } else if ((arr[i] == 'e' || arr[i] == 'E') && !eFlag && numFlag) {
                eFlag = true;
                numFlag = false;
            } else if ((arr[i] == '+' || arr[i] == '-') && (i == 0 || arr[i - 1] == 'e' || arr[i - 1] == 'E')) {

            } else {
                return false;
            }


        }
        return true;
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.isNumber("2e0"));

    }




}